package com.qzy.mybatisplus.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.qzy.mybatisplus.entity.KohlerEntity;
import com.qzy.mybatisplus.service.KohlerService;
import com.qzy.mybatisplus.utils.PageUtils;
import com.qzy.mybatisplus.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;





/**
 * 
 *
 * @author joe_qiu
 * @email 281358996@qq.com
 * @date 2021-03-22 15:37:16
 */
@RestController

@RequestMapping("product/kohler")
public class KohlerController {
    @Autowired
    private KohlerService kohlerService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("product:kohler:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = kohlerService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("product:kohler:info")
    public R info(@PathVariable("id") Long id){
		KohlerEntity kohler = kohlerService.getById(id);

        return R.ok().put("kohler", kohler);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("product:kohler:save")
    public R save(@RequestBody KohlerEntity kohler){
		kohlerService.save(kohler);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("product:kohler:update")
    public R update(@RequestBody KohlerEntity kohler){
		kohlerService.updateById(kohler);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("product:kohler:delete")
    public R delete(@RequestBody Long[] ids){
		kohlerService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
